package com.danger.Activity;

import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.ImageView;
import com.tandong.swichlayout.BaseEffects;
import com.tandong.swichlayout.SwichLayoutInterFace;
import com.tandong.swichlayout.SwitchLayout;

public class SecondActivity extends BaseActivity implements SwichLayoutInterFace {

    private ImageView imageView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_second);

        initView();
        initEvent();

    }

    @Override
    public void initView() {
        setEnterSwichLayout();
        imageView = (ImageView) findViewById(R.id.imageView);
        SwitchLayout.getFadingIn(imageView);
    }

    @Override
    public void initEvent() {
        imageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                SwitchLayout.getFadingIn(imageView);
            }
        });
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        switch (keyCode) {
            case KeyEvent.KEYCODE_BACK:
                setExitSwichLayout();
                break;
            default:
                break;
        }
        return true;
    }

    @Override
    public void setEnterSwichLayout() {
        SwitchLayout.getSlideFromLeft(this, false, null);
    }

    @Override
    public void setExitSwichLayout() {
        SwitchLayout.getSlideToLeft(this, true, BaseEffects.getMoreQuickEffect());
    }
}
